$(function() {
	$('#vue_vm_list div').hide();
});

var beHospitalPledge = {
	beHospitalPledgeId: '',
	elderId: '',
	elderName: '',
	elderCardId: '',
	pledge: '',
	handleId: '',
	handleName: '',
	status: '',
	retreatMoney: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
};

var view = {
	data: beHospitalPledge
};

var vue_vm = new Vue({
	el: '#vue_vm',
	data: view
});

function save() {
	view.data.pledge = (view.data.pledge==''? 0: parseFloat(view.data.pledge));
	view.data.status = (view.data.status==''? 0: parseInt(view.data.status));
	view.data.retreatMoney = (view.data.retreatMoney==''? 0: parseFloat(view.data.retreatMoney));

	save_basic(path+'/beHospitalPledge/save', {beHospitalPledge:view.data}, function() {
		alert('保存成功');
		findAll();
	});
}

function findAll() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();

	findAll_basic(path+'/beHospitalPledge/findAll', function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			}
		});
		
		$('#vue_vm_list div').show();
	});
}

function deleteBatch() {
	deleteBatch_basic(path+'/beHospitalPledge/deleteBatch');
}
